import { FastifyInstance } from "fastify";
import { sendCode } from "@helpers";

export const sendVerifyAgain = async (fastify: FastifyInstance) => {
    fastify.post(
        "/organization/sendVerifyAgain",
        {
            preHandler: fastify.auth("organization", false),
            schema: {
                tags: ["organization"],
            },
        },
        async (req, res) => {
            //Отправляем код по почте на которую зарегали
            await sendCode(req.organization.email, "organization");
            return res.send({
                message: "Код отправлен на вашу почту!",
            });
        }
    );
};
